{template header}
<script charset="utf-8" src="static/bootstrap/js/utils.js"></script>
<script type="text/javascript">
  function checkSortOrder(sort_order)
  {
     if(!Utils.isInt(sort_order))
     {
      alert('请输入整数');
      return false;
     }
     if(sort_order >= 1000)
     {
      alert('请输入一个不大于999的整数');
      return false;
     }
     return true;
  }
</script>
{if $tips}
<div class="alert">{$tips}<a class="close" data-dismiss="alert" href="#">&times;</a></div>
{else}
<form class="form-horizontal" action="index.php?c=admin&a=userBgInfo" method="post" enctype="multipart/form-data">
  <div class="control-group">
    <label class="control-label" for="inputTiltle">背景图名称：</label>
    <div class="controls">
      <input type="text" name='background_name' placeholder="请输入背景图名称" value="{$bgInfo['background_name']}">
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputThumbImg">背景图：</label>
    <div class="controls">
      {if $bgInfo['background_url']}
      <img src="{$bgInfo['background_url']}?time={eval echo time()}" alt="背景图">
      {/if}
      <input type="file" name="background_img">
      <div>背景图尺寸不宜超过720*696</div>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputThumbImg">背景缩略图：</label>
    <div class="controls">
      {if $bgInfo['short_url']}
      <img src="{$bgInfo['short_url']}?time={eval echo time()}" alt="背景缩略图：">
      {/if}
      <input type="file" name="thumb_img">
      <div>背景缩略图尺寸不宜超过230*310</div>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputShortDesc">是否显示：</label>
    <div class="controls">
      <select name="is_show">
        <option value="1">是</option>
        <option {if $bgInfo['is_show'] == 0} selected="selected" {/if} value="0">否</option>
      </select>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputauthor">显示优先级：</label>
    <div class="controls">
      <input type="text" name="sort_order" placeholder="请设置显示优先级" value="{$bgInfo['sort_order']}" onblur="checkSortOrder(this.value);" id="sort_order">
      <div>请输入一个不大于999的正整数，值越大，显示越靠前，值相同的背景，最先添加的显示在前面</div>
    </div>
  </div>
  <div class="control-group">
    <div class="controls">
        <input type="hidden" name="background_id" value="{$bgInfo['background_id']}">
        {if $type == 'add'}
          <input type="hidden" name="type" value="insert">
        {elseif $type == 'edit'}
          <input type="hidden" name="type" value="update">
        {/if}
        <button type="submit" class="btn">提交</button>
    </div>
  </div>
</form>
{/if}
{template footer}